﻿@using WebSite.ViewModels.Fields
@using WebSite.Views
@using WebSite.ViewModels
@using Attribute = ControleRepresentante.Logic.Models.Attribute

@model WebSite.ViewModels.EditViewModels.ConfiguracoesEditViewModel

@{
    ViewBag.Title = "Details";
}

<h2>Configurações</h2>

@using (Html.BeginForm("Edit", "Configuracoes", FormMethod.Post, new { id = "editForm", name = "editForm" }))
{
    Html.ValidationSummary(true);
    @Html.TextArea("Nome pedido", "nomePedido", Model.RepresentanteInfo.NomePedido, new { cols = 100 })
    @Html.TextArea("Info pedido", "infoPedido", Model.RepresentanteInfo.InfoPedido, new { cols = 100, rows = 5 })
    Attribute selectedAttribute = Model.RepresentanteInfo.VendedorPedidoAttribute;
    DropDownListField vendedorPedidoAttribute = new DropDownListField(null, "vendedorPedidoAttributeId")
        .AddEmpty(selectedAttribute == null, "Usar nome do vendedor");
    foreach (Attribute attribute in Model.Attributes)
    {
        vendedorPedidoAttribute.Add(attribute.Name, attribute.Id, selectedAttribute != null && selectedAttribute.Id == attribute.Id);
    }
    @Html.FieldFor("Vendedor Pedido Atributo", vendedorPedidoAttribute.Render(Html))
    <br />
    @(Html.Buttons()
        .Add(ButtonType.Insert, "#", "Salvar", "javascript:editForm.submit()")
        .Add(Model.RepresentanteInfo, "Configuracoes", ButtonType.Cancel))
}
